<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('计划列表')"/>
    <style>
        .fixed-table-toolbar {
            display: none;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <input type="hidden" name="orderId" th:value="${orderId}"/>
                        <input type="hidden" id="status" name="status" th:value="${status}">

                        <input name="params[ancestors]" th:value="${ancestors}" type="hidden"/>
                        <li>
                            计划编号：<input type="text" name="planCode"/>
                        </li>
                        <li>
                            作物名称：<input type="text" name="cropNameCn"/>
                        </li>
                        <li>
                            作物品种：<input type="text" name="cropVarietiesCn"/>
                        </li>
                        <li class="select-time">
                            <label>育苗： </label>
                            <input type="text" class="time-input" id="beginPlanTime" placeholder="开始时间"
                                   name="params[beginPlanTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endPlanTime]"/>
                        </li>
                        <li>
                            生产班组：<input type="text" name="teamCn"/>
                        </li>

                        <li>
                            计划制定人：<input type="text" name="createBy"/>
                        </li>


                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
    <div class="bottom-btns"></div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncPlan:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncPlan:remove')}]];
    var prefix = ctx + "system/ncPlan";

    var landType = [[${@dict.getType('landType')}]];
    var status = [[${status}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            // url: prefix + "/list?status=" + status,
            exportUrl: prefix + "/export",
            modalName: "计划",
            showSearch : false,
            showColumns : false,
            showExport : false,
            showRefresh : false,
            showToggle : false,
            columns: [
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'planId',
                    title: '计划id',
                    visible: false
                },
                {
                    field: 'planCode',
                    title: '计划编号',
                    sortable: true
                },
                {
                    field: 'cropNameCn',
                    title: '作物名称',
                },
                {
                    field: 'cropVarietiesCn',
                    title: '作物品种',
                },
                {
                    field: 'planTime',
                    title: '育苗时间',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return dateFtt(value);
                    }

                },
                {
                    field: 'teamCn',
                    title: '生产班组',
                    sortable: true
                },
                {
                    field: 'chaci',
                    title: '茬次',
                    sortable: true
                },
                {
                    field: 'count',
                    title: '数量(株)',
                    sortable: true
                },
                {
                    field: 'plateCount',
                    title: '盘数',
                    sortable: true
                },
                {
                    field: 'cycleDays',
                    title: '循环天数',
                    sortable: true
                },
                {
                    field: 'area',
                    title: '单茬面积(亩)',
                    sortable: true
                },
                {
                    field: 'jian',
                    title: '间数',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '计划制定时间',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'createBy',
                    title: '计划制定人',
                    sortable: true
                },
                {
                    field: 'standard.standardName',
                    title: '标准名称',

                }, {
                    field: 'status',
                    title: '状态',

                    formatter: function (value, row, index) {
                        /*状态 1:待生成订单 2：待执行 3.在执行 4.已完成*/
                        if (value == 1) {
                            return '<span class="badge badge-warning">待生成订单</span>'
                        } else if (value == 2) {
                            return '<span class="badge badge-info">待执行</span>'
                        } else if (value == 3) {
                            return '<span class="badge badge-primary">在执行</span>'
                        } else if (value == 4) {
                            return '<span class="badge badge-success">已完成</span>'
                        } else {
                            return "--";
                        }
                    }
                },
                /*{
                    field: 'remark',
                    title: '备注',
                },*/
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="showDetails(\'' + row.planId + '\')"><i class="fa fa-send"></i>详情</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /*查看详情*/
    function showDetails(planId) {
        var link = ctx + 'system/ncPlan/planDetail?planId=' + planId + "&planType=1";
        $.modal.openTab('计划详情', link);
    }
</script>
</body>
</html>